//
//  SupervisionTagsCell.m
//  HengHuaSupervision
//
//  Created by XD-XY on 3/23/14.
//  Copyright (c) 2014 XD-XY. All rights reserved.
//

#import "SupervisionTagsCell.h"
#import "XDHeader.h"
#import "XDTools.h"

@implementation SupervisionTagsCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self makeView];
    }
    return self;
}

-(void)makeView
{
     //标签编号{]
    CGFloat aheight = mHomepage_Cell_Height;
    
    self.tagIdLabel = [UILabel initLabel:CGRectMake(0, 0, 312/2.0f,aheight) textFont:mHomepage_text_Font textColor:mHomepagelist_Text_Color textAlignment:NSTextAlignmentCenter];
    
    //贴标签部位
    self.partLabel = [UILabel initLabel:CGRectMake(width_x(_tagIdLabel)+1, 0, 309/2.0f, aheight) textFont:mHomepage_text_Font textColor:mHomepagelist_Text_Color textAlignment:NSTextAlignmentCenter];
    
    //设备名称
    self.DeviceLabel = [UILabel initLabel:CGRectMake(width_x(_partLabel)+1, 0, 309/2.0f,aheight) textFont:mHomepage_text_Font textColor:mHomepagelist_Text_Color textAlignment:NSTextAlignmentCenter];
    
    //扫描人位置
    self.locationLabel = [UILabel initLabel:CGRectMake(width_x(_DeviceLabel)+1, 0, 464/2.0f,aheight) textFont:mHomepage_text_Font textColor:mHomepagelist_Text_Color textAlignment:NSTextAlignmentCenter];
    
    //贴码时间
    self.createTimeLabel = [UILabel initLabel:CGRectMake(width_x(_locationLabel)+1, 0,464/2.0f,aheight) textFont:mHomepage_text_Font textColor:mHomepagelist_Text_Color textAlignment:NSTextAlignmentCenter];
    
    [self addSubview:_tagIdLabel];
    [self addSubview:_partLabel];
    [self addSubview:_DeviceLabel];
    [self addSubview:_locationLabel];
    [self addSubview:_createTimeLabel];
    
    //cell未选中效果
    self.diselectBg = [[UIImageView alloc] init];
    _diselectBg.frame = CGRectMake(0, 0, self.frame.size.width,self.frame.size.height);
    self.backgroundView = _diselectBg;
    
}

-(void)isHarderTableViewCell
{
    //表头改变字体大小和颜色
    [self changeLabelTextcolorAndFont:_tagIdLabel];
    [self changeLabelTextcolorAndFont:_partLabel];
    [self changeLabelTextcolorAndFont:_DeviceLabel];
    [self changeLabelTextcolorAndFont:_locationLabel];
    [self changeLabelTextcolorAndFont:_createTimeLabel];
    
    //创建分割线
    UIImage * image = mHomepage_Head_Cutline_Img;
    UIImageView * lineView1  = [[UIImageView alloc] initWithFrame:CGRectMake(width_x(_tagIdLabel), 0, image.size.width, image.size.height)];
    lineView1.image = image;
    UIImageView * lineView2  = [[UIImageView alloc] initWithFrame:CGRectMake(width_x(_partLabel), 0, image.size.width, image.size.height)];
    lineView2.image = image;
    UIImageView * lineView3  = [[UIImageView alloc] initWithFrame:CGRectMake(width_x(_DeviceLabel), 0, image.size.width, image.size.height)];
    lineView3.image = image;
    UIImageView * lineView4  = [[UIImageView alloc] initWithFrame:CGRectMake(width_x(_locationLabel), 0, image.size.width, image.size.height)];
    lineView4.image = image;
    
    [self addSubview:lineView1];
    [self addSubview:lineView2];
    [self addSubview:lineView3];
    [self addSubview:lineView4];    
}

-(void)changeLabelTextcolorAndFont:(UILabel *)label
{
    label.textColor = mHomepage_Head_Text_Color;
    label.font = mHomepage_Head_text_Font;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
